import javax.swing.ImageIcon;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class HintButtonPanel extends javax.swing.JPanel implements ActionListener{
	private HintButton doubleScoreButton;
	private HintButton halveChoiceButton;
	private HintButton skipButton;
	
	public HintButtonPanel(){
		doubleScoreButton = new HintButton("x2");
		halveChoiceButton =  new HintButton("50:50");
		skipButton =  new HintButton("Skip");
		
		if(!Main.getUser().isDoubleScoreButtonUsed())	doubleScoreButton.addActionListener(this);
		else	doubleScoreButton.updateUsedButton();
		
		if(!Main.getUser().isHalveChoiceButtonUsed())	halveChoiceButton.addActionListener(this);
		else	halveChoiceButton.updateUsedButton();
			
		if(!Main.getUser().isSkipButtonUsed())	skipButton.addActionListener(this);
		else	skipButton.updateUsedButton();
		
		add(doubleScoreButton);
		add(halveChoiceButton);
		add(skipButton);
	}
	
	public void actionPerformed(ActionEvent e){
		if(e.getSource() == doubleScoreButton){
			Main.getUser().setDoubleScoreButtonUsed(true);
			
		}else if(e.getSource() == halveChoiceButton){
			Main.getUser().setHalveChoiceButtonUsed(true);
			Main.getCurrentQuestion().halveTheChoices();
		}else if(e.getSource() == skipButton){
			Main.getUser().setSkipButtonUsed(true);
		}
		
	}
}